package br.com.javajsf.modelo;

import java.io.Serializable;

public class ContaCliente implements Serializable {

	private static final long serialVersionUID = 3631982588666079413L;
	private Cliente cliente;
	private double valorTotal;
	
	public ContaCliente(int cod, String nome, double valorTotal){
		cliente = new Cliente(cod, nome);
		this.valorTotal = valorTotal;
	}
	
	//
	public Cliente getCliente() {
		return cliente;
	}
	public void setCliente(Cliente cliente) {
		this.cliente = cliente;
	}
	public double getValorTotal() {
		return valorTotal;
	}
	public void setValorTotal(double valorTotal) {
		this.valorTotal = valorTotal;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((cliente == null) ? 0 : cliente.hashCode());
		long temp;
		temp = Double.doubleToLongBits(valorTotal);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContaCliente other = (ContaCliente) obj;
		if (cliente == null) {
			if (other.cliente != null)
				return false;
		} else if (!cliente.equals(other.cliente))
			return false;
		if (Double.doubleToLongBits(valorTotal) != Double
				.doubleToLongBits(other.valorTotal))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "ContaCliente [cliente=" + cliente + ", valorTotal="
				+ valorTotal + "]";
	}
	
}
